package com.homson.coreservice.serviceview.controller;

import com.homson.coreservice.serviceapi.query.AccountQueryApi;
import com.homson.coreservice.serviceapi.query.AiAgentApi;
import com.homson.coreservice.serviceapi.query.TransactionQueryApi;
import com.homson.coreservice.servicecommon.request.AccountQueryRequest;
import com.homson.coreservice.servicecommon.request.PageRequestParameter;
import com.homson.coreservice.servicecommon.request.RequestParameter;
import com.homson.coreservice.servicecommon.request.TransactionQueryRequest;
import com.homson.coreservice.servicecommon.response.EntityResponse;
import com.homson.coreservice.servicecommon.response.PageResponse;
import com.homson.coreservice.servicecommon.vo.AccountVO;
import com.homson.coreservice.servicecommon.vo.TransactionVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/query")
public class QueryController {
    
    @Autowired
    private AiAgentApi aiAgentApi;
    @Autowired
    private TransactionQueryApi transactionQueryApi;
    @Autowired
    private AccountQueryApi accountQueryApi;
    
    @PostMapping("/chat")
    public EntityResponse<String> simpleChat(@RequestBody RequestParameter<String> request) {
        return aiAgentApi.simpleChat(request);
    }
    
    @PostMapping("/queryTransactionListRender")
    public PageResponse<List<TransactionVO>> queryTransactionListRender(@RequestBody PageRequestParameter<TransactionQueryRequest> request) {
        return transactionQueryApi.queryTransactionListRender(request);
    }
    @PostMapping("/queryAccountListRender")
    public PageResponse<List<AccountVO>> queryAccountList(@RequestBody PageRequestParameter<AccountQueryRequest> request){
        return accountQueryApi.queryAccountList(request);
    }
}
